package cz.uvn.orthopedy.client.entity;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.gwt.user.client.rpc.IsSerializable;

@PersistenceCapable
public class Hall implements IsSerializable, Comparable<Hall> {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private int number;
	
	@Persistent
	private String description;
	
	public Hall() {
	}

	public Hall(Long id, int number, String description) {
		this.id = id;
		this.number = number;
		this.description = description;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		return "Hall " + number;
	}

	@Override
	public int compareTo(Hall h) {
		return this.number - h.getNumber();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Hall) {
			return ((Hall) obj).id == this.id;
		}
		return false;
	}
	
}
